﻿<?xml version="1.0" encoding="utf-8" ?>
<entityInfo>
  <aliases>
    <alias id="address">
      SELECT AddressId,City,PrimaryAddress,Country,PostalCode,PersonId FROM Address
    </alias>
  </aliases>

  <sqlStatements>
    <selectStatement id="all" resultMap="addressMap">
      <command>
        {address}
      </command>
    </selectStatement>
    <changeStatement id="delete" parameterMap="idMap">
      <command>
        DELETE FROM Address WHERE AddressId=@id
      </command>
    </changeStatement>
    <singleSelectStatement id="byid" resultMap="addressMap" parameterMap="idMap">
      <command>
        {address} WHERE AddressId=@id
      </command>
    </singleSelectStatement>
    <singleSelectStatement id="bypersonid" resultMap="addressMap" parameterMap="personIdMap">
      <command>
        {address} WHERE PersonId=@personid
      </command>
    </singleSelectStatement>
  </sqlStatements>

  <maps>
    <resultMap id="addressMap">
      <fields>
        <field property="Id" column="AddressId" />
        <field property="City" column="City" />
        <field property="PrimaryAddress" column="PrimaryAddress" />
        <field property="Country" column="Country" />
        <field property="PostalCode" column="PostalCode" />
      </fields>
    </resultMap>
    <parameterMap id="idMap">
      <params>
        <param name="id" property="Id" />
      </params>
    </parameterMap>
    <parameterMap id="personIdMap">
      <params>
        <param name="personid" property="Id" />
      </params>
    </parameterMap>
  </maps>

</entityInfo>